|
|
|
|
|
|
|
ExecDirect = intResult
Err.Raise vbObjectError + 12, App.EXEName, "Error executing Query"
intResult = SQLFreeStmt(hStmt, sqlClose)
Exit Function
End If
'
ExecDirect = sqlSuccess
'
End Function |
|
|
|
|
|
|
|
|
The code in Listing 19.12 clears any current pending statement and then executes the SQL statements stored in the SQL property of the class. The Refresh method calls a number of other important methods. The first of these is the FetchRow method. This gets a row of data from the ODBC data source. Add the code in Listing 19.13 to your class. |
|
|
|
|
|
|
|
|
Listing 19.13. Coding the FetchRow method. |
|
|
|
|
|
|
|
|
Public Function FetchRow()
'
' get a row of data
'
Dim intResult As Integer
'
intResult = SQLFetch(hStmt)
If intResult <> sqlSuccess Then
If intResult <> sqlNoDataFound Then
Err.Raise vbObjectError + 14, App.EXEName, "Error fetching row"
FetchRow = intResult
Else
FetchRow = intResult
End If
Else
FetchRow = sqlSuccess
End If
'
End Function |
|
|
|
|
|
|
|
|
Next, you need to add the GetColumn method. This moves a column of data from the data source to the local memory space. Add the code in Listing 19.14 to the class. |
|
|
|
|
|
|
|
|
Listing 19.14. Coding the GetColumn method. |
|
|
|
|
|
|
|
|
Private Function GetColumn(strBuffer As String, intCol As Integer)
'
' get a column from the current row |
|
|
|
|
|